#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    string s;
    for (int i = 1; s.size() < 1e6; ++i) {
        s += to_string(i);
    }
    int r = 1;
    for (int i = 1; i <= 1e6; i *= 10)
        r *= s[i-1] - '0';
    cout << r << endl; // 210
}